/*
Author Dave Lenz
Creation date: 16 jun 2009
 */
package nl.ypmits.utils.as3.view.interfaces.wheel {
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.filters.DropShadowFilter;

	public class WheelArrow extends Sprite {

		private var bottomCircle : Shape;
		private var bottomSquare : Shape;
		private var bottomArrow : Shape;

		
		public function WheelArrow() {
			bottomCircle = new Shape();
			addChild( bottomCircle );
			
			bottomSquare = new Shape();
			addChild( bottomSquare );
			
			bottomArrow = new Shape();
			addChild( bottomArrow );
			
			var bf : DropShadowFilter = new DropShadowFilter( );
			bf.quality = 3;
			bf.blurX = bf.blurY = 5;
			bf.alpha = .35;
			filters = [ bf ];
		}

		
		public function draw( mouseDeg : Number ) : void {
			var thickness : Number = 5;
			var length : Number = 60;
			
			bottomCircle.graphics.clear( );
			bottomCircle.graphics.beginFill( 0x000000, 1 );
			bottomCircle.graphics.drawCircle(0, 0, thickness / 2);
			bottomCircle.graphics.endFill();
			
			bottomSquare.graphics.clear();
			bottomSquare.graphics.beginFill( 0x000000, 1 );
			bottomSquare.graphics.drawRect(0, -(thickness * .5), length, thickness );
			bottomSquare.graphics.endFill();
			
			bottomArrow.graphics.clear();
			bottomArrow.graphics.beginFill( 0x000000, 1 );
			bottomArrow.graphics.moveTo( length, -thickness * 1.2 );
			bottomArrow.graphics.lineTo( length, thickness * 1.2 );
			bottomArrow.graphics.lineTo( length + (thickness * 3), 0 );
			bottomArrow.graphics.endFill();
			
			rotation = mouseDeg;
		}

		
		public function clear() : void {
			bottomCircle.graphics.clear( );
			bottomSquare.graphics.clear();
			bottomArrow.graphics.clear();
			graphics.clear( );
		}
	}
}
